#ifndef MENU_ITEM_H
#define MENU_ITEM_H

#include "consts.h"
#include "cash.h"

class MENU_ITEM : public QObject, public QGraphicsItemGroup
{
    Q_OBJECT
    Q_PROPERTY(qreal transparent READ Transparent WRITE setTransparent)

private:
    GRAPHICS_PIXMAP_ITEM *item_normal;
    GRAPHICS_PIXMAP_ITEM *item_hover;

    QGraphicsItemAnimation *anim;
    QGraphicsItemAnimation *anim_hover;

//точки позиций кнопки
    QPointF pos_normal;
    QPointF pos_unvis;
    QPointF pos_hover;

//фактор выдвигания выбранного элемента
    int hover_pos_factor;

//time lines
    QTimeLine *tl_hover;
    QTimeLine *tl_anims;

    QPropertyAnimation *prop_anim;

    MENU_ITEM_TYPE type;

    CASH *cash;

public:
    MENU_ITEM(MENU_ITEM_TYPE type, QTimeLine *tl_anims,CASH *cash);

    QPainterPath shape() const;
    QRectF boundingRect() const;

    void init();
    void anim_init();

    void set_focus(bool value);
    void set_visible(bool value);

    QTimeLine *Get_tl_hover();
    MENU_ITEM_TYPE Get_item_type();

    ~MENU_ITEM();

private:
//property
    qreal Transparent();
    void setTransparent(qreal value);
};

#endif // MENU_ITEM_H
